# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Johnathan Jenkins <twodopeshaggy@gmail.com>
# Contributor: prettyvanilla <prettyvanilla@posteo.at>
# Contributor: almostalive <almostalive2003@gmail.com>

pkgname=libretro-genesis-plus-gx
pkgver=2022
pkgrel=1
pkgdesc='Sega MS/GG/MD/CD core'
arch=(loong64 x86_64)
url=https://github.com/libretro/Genesis-Plus-GX
license=(BSD LGPL2.1)
groups=(libretro)
depends=(
  libretro-core-info
  libvorbis
  zlib
)
makedepends=(
  clang
  git
)
_commit=7571d8dd56d05dd1e4c762c85a688ea713a84b75
source=(libretro-genesis-plus-gx::git+https://github.com/libretro/Genesis-Plus-GX.git#commit=${_commit})
b2sums=(SKIP)

pkgver() {
  cd libretro-genesis-plus-gx
  git rev-list --count HEAD
}

build() {
  export CC=clang # FS#71188 - [libretro-genesis-plus-gx] segfaults when compiled with -O2
  make \
    SHARED_LIBVORBIS=1 \
    SYSTEM_ZLIB=1 \
    -C libretro-genesis-plus-gx \
    -f Makefile.libretro
}

package() {
  install -Dm 644 libretro-genesis-plus-gx/genesis_plus_gx_libretro.so -t "${pkgdir}"/usr/lib/libretro/
  install -Dm 644 libretro-genesis-plus-gx/LICENSE.txt -t "${pkgdir}"/usr/share/licenses/libretro-genesis-plus-gx/
}

# vim: ts=2 sw=2 et:
